function saveAs(title, content, markdown)
{
    var contentTemplate =	'<!DOCTYPE html>' +
        '<html lang="zh">' +
        '<head>' +
        '	<meta charset="utf-8" />' +
        '	<title>{{{ title }}}</title>' +
        '    <link rel="stylesheet" href="css/style.css" />' +
        '    <link rel="stylesheet" href="css/editormd.css" />' +
        '</head>' +
        '<body>' +
        '  <div id="content">' +
        '{{{ content }}}' +
        '	</div>' +
        '</body>' ;
    var templateFunction = Handlebars.compile(contentTemplate);
    var data = {"title": title, "content": content};
    var result = templateFunction(data);

    // alert(markdown)

    if (name == null)
    {
        name = dt.getFullYear() + "-" + (dt.getMonth() + 1) + "-" + dt.getDate() + "-" + dt.getTime() + ".html";
    }

    $.ajax({ url: "/add",
        method: "post",
        data: {
            'name': name,
            'content': result,
            'markdown': markdown
        },
        success: function(){
            alert("Save Success");
        }
    });
}
function listAll()
{
    window.location.href = "list.php";
}